﻿<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<fmt:message key="menu_email2_label1" var="menu_email2_label1"/>
<fmt:message key="menu_email2_label2" var="menu_email2_label2"/>
<fmt:message key="menu_email2_label3" var="menu_email2_label3"/>
<fmt:message key="menu_email2_label4" var="menu_email2_label4"/>
<fmt:message key="menu_email2_label5" var="menu_email2_label5"/>
<fmt:message key="menu_email2_label6" var="menu_email2_label6"/>
<fmt:message key="menu_email2_label7" var="menu_email2_label7"/>
<fmt:message key="menu_email2_label8" var="menu_email2_label8"/>
<fmt:message key="menu_email2_label9" var="menu_email2_label9"/>

<c:if test="${not empty emailBoxs}">
<TABLE class=leftColumnModuleHead cellSpacing=0 cellPadding=0 width="100%" border=0 valign="top">
 <TBODY>
  <TR>
    <TH class="menu_title_left" width=48>&nbsp;</TH>
    <TH class="menu_title_middle">${menu_email2_label9}</TH>
	<th width="48" align="right" class="menu_title_right"></th>
  </TR>
 </TBODY>
</TABLE>
<TABLE class=subMenu cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
	    <c:forEach items="${emailBoxs}" var="emailBox">
		    <c:if test="${emailBox.displayName==menu_email2_label2}">
		    	<c:set var="icon">folder.gif</c:set>
		    </c:if>
		    <c:if test="${emailBox.displayName==menu_email2_label4}">
		    	<c:set var="icon">folder_send.gif</c:set>
		    </c:if>
		    <c:if test="${emailBox.displayName==menu_email2_label3}">
		    	<c:set var="icon">folder_draft.gif</c:set>
		    </c:if>
		    <c:if test="${emailBox.displayName==menu_email2_label5}">
		    	<c:set var="icon">folder_dustbin.gif</c:set>
		    </c:if>
		    <c:if test="${emailBox.displayName!=menu_email2_label12 && emailBox.displayName!=menu_email2_label4 && emailBox.displayName!=menu_email2_label3 && emailBox.displayName!=menu_email2_label5}">
		    	<c:set var="icon">folder.gif</c:set>
		    </c:if>
	     	<TR>
	    <TD class=subMenuTDIcon 
	    style="BACKGROUND-IMAGE: url(../../themes/${sessionScope.loginUser.theme}/images/createBg.gif); BACKGROUND-REPEAT: repeat-y" 
	    width=16><A class=subMenuLink 
	      onmouseover="document.getElementById('submenu_email2Folderdelbox_${emailBox.id}').style.background='#f2f4fb';" 
	      onmouseout="document.getElementById('submenu_email2Folderdelbox_${emailBox.id}').style.background='#ffffff';" 
	      href="<c:url value="/modules/email2/email2.do?method=list&box=${emailBox.id}"/>"><IMG 
	      height=16 alt="${emailBox.displayName}" 
	      src="../../themes/${sessionScope.loginUser.theme}/images/${icon}" 
	      width=16 align=absMiddle border=0></A></TD>
	      
	    <TD class=subMenuTD id="submenu_email2Folderdelbox_${emailBox.id}"
	    onmouseover="this.style.background='#f2f4fb';this.style.cursor='hand';" 
	    onmouseout="this.style.background='#ffffff';this.style.cursor='auto';" 
	    noWrap><A class=subMenuLink 
	      href="<c:url value="/modules/email2/email2.do?method=list&ec_s_sendDate=desc&box=${emailBox.id}"/>">${emailBox.displayName}</A>
	    <c:set var="newCount">0</c:set>
	    <c:forEach items="${emailBox.emails}" var="email">
		    <c:if test="${email.isseen==0}">
		    	<c:set var="newCount">${newCount+1}</c:set>
		    </c:if>
	    </c:forEach>
	    <c:if test="${newCount>0 && emailBox.displayName!=menu_email2_label2}">
	    	(<span id="newEmailCount" class="required">${newCount}</span>)
	    </c:if>
	    <c:if test="${emailBox.displayName==menu_email2_label2}">
	    	(<span id="sjx_newEmailCount" class="required">${newCount}</span>)<span id="sjx_newEmailImg"></span>
	    </c:if>
	    </TD></TR>	
	      
		</c:forEach>
 </TBODY>
</table>
</c:if>
	<c:set var="bulletinCount" value="0"/>
	
<script src='<c:url value="/dwr/util.js"/>'></script>
<script src='<c:url value="/dwr/interface/ajaxEmail2Manager.js"/>'></script>
<script language="javascript">

function evaluationInBoxCount(obj){
if(obj!=0)
	document.getElementById('submenu495').innerHTML = "<A class=subMenuLink href='../../modules/email2/email2.do?method=list&box=inbox&ec_s_sendDate=desc'>&nbsp;&nbsp${menu_email2_label2}&nbsp;<font color='red'>("+obj+")<font></A>"
	
}
function evaluationOutBoxCount(obj){
if(obj!=0)
	document.getElementById('submenu496').innerHTML = "<A class=subMenuLink href='../../modules/email2/email2.do?method=list&box=sendbox&ec_s_sendDate=desc'>&nbsp;&nbsp${menu_email2_label4}&nbsp;<font color='red'>("+obj+")<font></A>"
}
function evaluationSaveBoxCount(obj){
if(obj!=0)
	document.getElementById('submenu497').innerHTML = "<A class=subMenuLink href='../../modules/email2/email2.do?method=list&box=draftbox&ec_s_sendDate=desc'>&nbsp;&nbsp${menu_email2_label3}&nbsp;<font color='red'>("+obj+")<font></A>"
}
function evaluationTrashBoxCount(obj){
if(obj!=0)
	document.getElementById('submenu498').innerHTML = "<A class=subMenuLink href='../../modules/email2/email2.do?method=list&box=delbox&ec_s_sendDate=desc'>&nbsp;&nbsp${menu_email2_label5}&nbsp;<font color='red'>("+obj+")<font></A>"
}

function addUnreadMail(menu,count){
	if(count != 0){
		var cc = document.createElement("font");
		cc.setAttribute("color", "red");
		cc.appendChild(document.createTextNode("("+count+")"))
		$(menu).appendChild(cc);
	}
}

<c:forEach items="${mailCounts}" var="mailCount">
	<c:if test="${mailCount.name==menu_email2_label2}">
		addUnreadMail("submenu495",${mailCount.count});
	</c:if>
	<c:if test="${mailCount.name==menu_email2_label4}">
		addUnreadMail("submenu496",${mailCount.count});
	</c:if>
	<c:if test="${mailCount.name==menu_email2_label3}">
    	addUnreadMail("submenu497",${mailCount.count});
    </c:if>
    <c:if test="${mailCount.name==menu_email2_label5}">
    	addUnreadMail("submenu498",${mailCount.count});
    </c:if>
</c:forEach>
</script>